package code;

import java.util.Scanner;

public class IsFlipedString_day03 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s1 = sc.nextLine();
        String s2 = sc.nextLine();
        sc.close();
        if(s1.length() != s2.length()){
            System.out.println("False");
        }
        String s2_s2=s2+s2;
        int i=0;
        int j=0;
        int temp_pre=0;//存储上一个起始位置
        while (i<s2_s2.length()&&j<s1.length()) {
            if(s2_s2.charAt(i)==s1.charAt(j)){
                i++;
                j++;
            }else {
                i=temp_pre+1;
                temp_pre++;
                j=0;
            }
        }
        if(j==s2.length()){
            System.out.println("True");
        }else {
            System.out.println("False");
        }

    }
}
